import axios from "axios"
export const addNumAction=()=>{
    return {
        type:'ADD_NUM'
    }
}
export const getListAction =()=>{
    return (dispatch)=>{
        axios.get("/list").then((res)=>[
            dispatch({
                type:'SET_LIST',
                payload:res.data
            })
        ])
    }
}
export const setActiveAction=(index)=>({
    type:"SET_ACTIVE",
    payload:index
})
export const getDataAction=()=>(dispatch)=>{
    axios.get("/data").then((res)=>{
        dispatch({
            type:"SET_DATA",
            payload:res.data
        })
    })
}
export const removeDataAction=(id)=>{
    return {
        type :"REMOCE_DATA",
        payload:id
    }
}
export const addDataAction=(values)=>{
    return{
        type:"ADD_DATA",
        payload:values
    }

}